#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "Note.h"
#import "NodeView.h"
#import "NodeButton.h"

@interface NoteNode : NSObject <NSCoding>{
	Note* note;
	bool isNote;
	bool isRest;
	NoteNode* parent;
	NSMutableArray* children;
	NodeView *noteView;
	NodeButton *button;
	UIImageView *rest;
	CGPoint pos;
	int tag;
}

@property (nonatomic, retain) Note* note;
@property CGPoint pos;
@property int tag;
@property (nonatomic) bool isNote;
@property (nonatomic) bool isRest;
@property (nonatomic, retain) NoteNode* parent;
@property (nonatomic, retain) NSMutableArray* children;
@property (nonatomic, retain) NodeView *noteView;
@property (nonatomic, retain) NodeButton *button;
@property (nonatomic, retain) UIImageView *rest;

-(id)initWholeNode;
-(id)initHalfNode:(NoteNode*)parentNode;
-(id)initQuarterNode:(NoteNode*)parentNode;
-(id)initEighthNode:(NoteNode*)parentNode;
-(void)drawNode;
-(void)addChild:(NoteNode*)childNode;
-(void)setDescendants;
-(void)setAncestors;
-(void)resetAncestors;
-(BOOL)hasNoteChild;
-(void)clearAllChildren;

@end
